<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><{:C('web_site_name')}></title>
    <link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/main.css"/>
    <script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/jquery.js"></script>
    <script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/lib.js"></script>
    <script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/layer.min.js"></script>
    <script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/admin.js"></script>
</head>
<body>
<div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i>首页<span class="crumb-step">&gt;</span><span class="crumb-name">角色管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="#" method="post">
                    <table class="search-tab">
                        <tr>
                           
                            <th width="70">角色名称:</th>
                            <td><input class="common-text" placeholder="角色名称" name="rolename" value="" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="button" onclick="search()"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="javascript:void(0)" onclick="add()"><i class="icon-font"></i>新增角色</a>
                    </div>
                </div>
                 <div class="list-page" id="page_string"> 2 条 1/1 页</div>
                <div class="result-content">
                    <table class="result-tab" width="100%" >
                        <tr>
                            <th>编号</th>
                            <th>角色名称</th>
                            <th>创建日期</th>
                            <th>状态</th>
                            <th>缓存文件路径</th>
                            <th>修改日期</th>
                       
                            <th>操作</th>
                        </tr>
                      <tbody id="result_"></tbody>
                        
                    </table>
                    
                    	
                    <div class="list-page" id="page_string"> 2 条 1/1 页</div>
                </div>
            </form>
        </div>
</body>
</html>
<script>
var loadding_0  ;
var page = 1 ;
$(function () {
	common_request();
});
function common_request(){

	var url="<?php echo U("role/index");?>&inajax=1";
	var data_ = {
		'page':page,
		'time':<?php echo time();?>,
		'action':'ajax_data' , 
		'rolename':$("input[name='rolename']").val() 
	} ;
    $.ax(
        url,data_,true,"POST","JSON",function(msg){
        var shtml = '' ;
        var list = msg.resultinfo.list;
        if(msg.resultcode != 1 ){
            layer.msg(msg.resultinfo.errmsg);
            return false ;
        }else{
            for(var i in list){
                shtml+='<tr>';
                shtml+= '<td>'+list[i].id+'</td>' ;
                shtml+='<td>'+list[i]['rolename']+'</td>';
                shtml+='<td>'+list[i]['addtime']+'</td>';
                shtml+='<td>'+list[i]['status']+'</td>';
                shtml+='<td>'+list[i]['cache_file']+'</td>';
                shtml+='<td>'+list[i]['filemtime']+'</td>';
                shtml+='<td><a href="<?php echo U('role/edit');?>&id='+list[i].id+'" class="tablelink">设置权限</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="del_role('+list[i].id+',this)" class="icon-remove"></a></td>';
                shtml+='</tr>';
            }
            $("#result_").html(shtml);
            $(".list-page").html(msg.resultinfo.obj);
        }
        layer.close(loadding_0);
        },function(e){
            layer.msg('服务器繁忙请稍后');
            return false ;   
        },function(f){
            loadding_0 = layer.load('数据正在加载中。。。。。。'); 
        }
    );
}
function ajax_data(p){
    page = p ;
	common_request();
}
function search(){
    page = 1 ;
	common_request();
}
//添加角色
function add(){
	$.layer({
	    type: 2,
	    shadeClose: true,
	    title: "添加后台角色",
	    closeBtn: [0, true],
	    shade: [0.8, '#000'],
	    border: [1],
	    offset: ['20px',''],
	    area: ['720px','320px'],
	    iframe: {src: "<?php echo U("role/add");?>&showpage=1"}
	}); 
}


</script> 
